package Lab06.Q5;


import java.util.Random;

public class Test {
    public static void main(String[] args){
        ShapeFactory s=new ShapeFactory();
        Shape[] s1 =new Shape[5];
        Shape[] s2=new Shape[5];
        for(Shape i:s1){
            i=s.randomNextShape();
            System.out.println(i.getClass().getSimpleName()+" "+i.calcArea()+'\n');
        }
        for(Shape i:s2){
            Random rand=new Random();//[0,3)
            switch(ShapeFactory.ShapeType.values()[rand.nextInt(3)]){
                case Rectangle ->i=new Rectangle(rand.nextDouble(10), rand.nextDouble() ) ;
                case Rhombus ->i=new Rhombus(rand.nextDouble(10), rand.nextDouble() ) ;
                case Ellipse ->i=new Ellipse(rand.nextDouble(10), rand.nextDouble() ) ;
            }
            System.out.println(i.getClass().getSimpleName()+" "+i.calcArea()+'\n');
        }
    }
}
